<?php
error_reporting(0);
header("Content-type: text/html; charset=UTF-8");
include_once 'check.php';
include_once '../comm/conn.php';

define( "PHP_MAGIC_GPC ",   get_magic_quotes_gpc()); 
function raddslashes(&$data) { 
    if(!PHP_MAGIC_GPC) { 
        return   is_array($data)?array_map( 'raddslashes',$data):addslashes($data); 
    } 
    else { 
        return   $data; 
		} 
} 
$_POST = raddslashes($_POST); 


if($_POST['sub']){
	$link = mysql_connect($dbserver, $dbuser, $dbpass);
    mysql_select_db($dbname);
    mysql_query("set names 'utf8'");
	if (!$link) {
	    echo "数据库连接失败";
	    exit;
    }
	$sql="update ".$BIAOTOU."websetting set uc='".$_POST['uc']."'";
	mysql_query($sql);
	
	$uc="<?php\r\n///\r\n".stripslashes($_POST['ucde']);
	file_put_contents('../data/config.inc.php',$uc);
}

mysql_close($link);
rename('easyuc.php','easyuc.php.lock');
unlink('easyuc.php');
echo '<script type="text/javascript">alert("设置完成");history.go(-1)</script>';
?>
